import Request from '@/utils/request.js'

export const Register = (registerData)=>{
    const params = new URLSearchParams();
    for(let key in registerData){
        params.append(key,registerData[key]);
    }
    return Request.post("/user/register",params);
}

export const UserLoginService = (LoginData)=>{
    const params = new URLSearchParams();
    for(let key in LoginData){
        params.append(key,LoginData[key]);
    }
    return Request.post("/user/login",params);
}

export const UserInfoService = ()=>{
    return Request.get("/user/userInfo");
}

export const UserUpdateService = (params) =>{
    return Request.put('/user/update',params);
}

export const UserAvatarService = (avatarUrl) =>{
    return Request.patch('/user/updateAvatar?avatarUrl='+avatarUrl);
}

export const UserResetPsd = (params)=>{
    return Request.patch('/user/updatePwd',params);
}

export const UserGetInfoByToken = (params)=>{
    return Request.get('/user/get/login',params);
}

export const AddUser = (params)=>{
    return Request.post('/user/add',params);
}

export const DeleteUser = (id)=>{
    return Request.delete(`/user/delete?id=${id}`);
}

export const UpdateUser = (params)=>{
    return Request.post('/user/updateUser',params);
}

export const GetUser = (id)=>{
    return Request.get(`/user/get?id=${id}`);
}

export const GetUserList = (params)=>{
    return Request.post('/user/list/page',params);
}

export const GetUserVoList = (params)=>{
    return Request.post('/user/list/vo',params);
}